(define (same-parity x . y)
  (define (filter proc items)
    (if (null? items)
        '()
        (if (proc (car items))
            (cons (car items)
                  (filter proc (cdr items)))
            (filter proc (cdr items)))))
  (let ((tail (if (even? x)
                  (filter even? y)
                  (filter odd? y))))
    (cons x tail)))